﻿using System.Windows.Controls;
using System.Windows;
using Microsoft.Expression.Controls;
using Microsoft.Expression.Interactivity.Layout;
using System.Windows.Interactivity;

//using DataArtistConnections;

namespace DataArtistConnections
{
    public partial class MainPage : UserControl
    {
        public MainPage()
        {
            InitializeComponent();
            Interaction.GetBehaviors(tralal).Add(new MouseDragElementBehavior());
            Interaction.GetBehaviors(dva).Add(new MouseDragElementBehavior());
            
        }

        private void b_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            

            ConnectBehavior cb = new ConnectBehavior();
            cb.ConnectTo = "dva";
            //cb.
            Interaction.GetBehaviors(tralal).Add(cb);
            Interaction.GetBehaviors(dva).Add(new ConnectBehavior());

            
            Connections.Add(tralal, dva, adjustOnly: false);
            Connections.Adjust(dva, tralal);

            //string s = "tralal";
            //b.Content = s;

            //foreach (UIElement ui in LayoutRoot.Children)
            //{
            //    ListBoxItem lbi = new ListBoxItem();
            //    lbi.Content = ui.GetType();
            //    lb.Items.Add(lbi);
            //    if (ui.GetType() == typeof(LineArrow))
            //    {
            //        tb.Text = Canvas.GetTop(ui).ToString() + " " + Canvas.GetLeft(ui).ToString(); 
            //    }
            //    //b.Content += " " + ui.GetType();
            //}
        }
    }
}
